package com.vincent.kdp.repository;

import com.loopj.android.http.RequestParams;
import com.vincent.baseapp.util.SPUtil;
import com.vincent.kdp.PostUrl;
import com.vincent.kdp.bean.CheckVersionBean;
import com.vincent.kdp.bean.CounterTotalOutput;
import com.vincent.kdp.bean.DifferentTitleBean;
import com.vincent.kdp.bean.JudgeGoodsSaleBean;
import com.vincent.kdp.bean.RePairRecordBean;
import com.vincent.kdp.bean.RepaireSpeedBean;
import com.vincent.kdp.http.HttpUtil;
import com.vincent.kdp.http.RequestCallBack;
import com.vincent.kdp.ui.bean.response.AllGoodsOnCheckOutput;
import com.vincent.kdp.ui.bean.response.BaseOutput;
import com.vincent.kdp.ui.bean.response.CommodityDetailOutput;
import com.vincent.kdp.ui.bean.response.ConfirmGoodsOutput;
import com.vincent.kdp.ui.bean.response.CounterOutput;
import com.vincent.kdp.ui.bean.response.InStockOutput;
import com.vincent.kdp.ui.bean.response.QueryRecordOutput;
import com.vincent.kdp.ui.bean.response.StartQueryOutput;
import com.vincent.kdp.ui.bean.response.UpdateCheckOutput;
import com.vincent.kdp.util.BaseParam;

import java.util.List;

public class CheckGoodsRepository {

    public void reqcConfirmGoods(String barCodeList, RequestCallBack callBack) {
        RequestParams params = new RequestParams();
        params.put("barCodeList", barCodeList);
        HttpUtil.loadData(PostUrl.COMFIREM_GOODS, params, ConfirmGoodsOutput.class, callBack);
    }

    public void reqGetGoodsOnShelf(RequestCallBack callBack) {
        RequestParams params = new RequestParams();
        params.put("number", BaseParam.getDeviceId());
        HttpUtil.loadData(PostUrl.GET_GOODS_ONSHELF, params, AllGoodsOnCheckOutput.class, callBack);
    }

    public void reqStartQuery(RequestCallBack callBack){
        RequestParams params = new RequestParams();
        params.put("number", BaseParam.getDeviceId());
        params.put("empId", SPUtil.getString("empId"));
        HttpUtil.loadData(PostUrl.START_PANHUO, params, StartQueryOutput.class, callBack);
    }

    public void reqUpdateCheck(String barCodes,int checkId,RequestCallBack callBack){
        RequestParams params = new RequestParams();
        params.put("number", BaseParam.getDeviceId());
        params.put("barCodes", barCodes);
        params.put("id",checkId);
        HttpUtil.loadData(PostUrl.TONGBU_PANHUO, params, UpdateCheckOutput.class, callBack);
    }

    public void reqGetRecordById(int queryId,RequestCallBack callBack){
        RequestParams params = new RequestParams();
        params.put("number", BaseParam.getDeviceId());
        params.put("queryId",queryId);
        HttpUtil.loadData(PostUrl.GET_RECORD_BY_ID, params, QueryRecordOutput.class, callBack);
    }
    //入柜查询
    public void listGoodsInStock(String hasCheckGoodsString, RequestCallBack callBack){
        RequestParams params = new RequestParams();
        params.put("number", BaseParam.getDeviceId());
        params.put("barCodes",hasCheckGoodsString);
        HttpUtil.loadData(PostUrl.GOODS_IN_STOCK, params, InStockOutput.class, callBack);
    }
    //扫描-获得柜台列表
    public void getlistCounter(RequestCallBack callBack){
        RequestParams params = new RequestParams();
        params.put("number", BaseParam.getDeviceId());
        HttpUtil.loadData(PostUrl.STOCK_LIST, params, CounterOutput.class, callBack);
    }
    //入柜
    public void overTheCounter(String hasCheckGoodsString,String counterId, RequestCallBack callBack){
        RequestParams params = new RequestParams();
        params.put("counterId",counterId);
        params.put("number", BaseParam.getDeviceId());
        params.put("goodsIdList",hasCheckGoodsString);
        HttpUtil.loadData(PostUrl.IN_STOCK, params, BaseOutput.class, callBack);
    }



    //柜台管理-柜台列表
    public void getCounterListTotal(int num,RequestCallBack callBack){
        RequestParams params = new RequestParams();
        params.put("pageNum", String.valueOf(num));
        params.put("number", BaseParam.getDeviceId());
        HttpUtil.loadData(PostUrl.COUNTER_LIST_TOTAL, params, CounterTotalOutput.class, callBack);
    }


    //柜台管理-获得商品列表
    public void getCounterList(RequestCallBack callBack){
        RequestParams params = new RequestParams();
        params.put("number", BaseParam.getDeviceId());
        HttpUtil.loadData(PostUrl.COUNTER_LIST, params, InStockOutput.class, callBack);
    }

    //转柜
    public void moveCounter(String hasCheckGoodsString,String counterId, RequestCallBack callBack){
        RequestParams params = new RequestParams();
        params.put("counterId",counterId);
        params.put("number", BaseParam.getDeviceId());
        params.put("goodsIdList",hasCheckGoodsString);
        HttpUtil.loadData(PostUrl.MOVE_STOCK, params, BaseOutput.class, callBack);
    }
    //下柜
    public void downCounter(String hasCheckGoodsString, RequestCallBack callBack){
        RequestParams params = new RequestParams();
        params.put("number", BaseParam.getDeviceId());
        params.put("goodsIdList",hasCheckGoodsString);
        HttpUtil.loadData(PostUrl.OUT_STOCK, params, BaseOutput.class, callBack);
    }
    public void getDifferentTitleByNum(RequestCallBack callBack){
        RequestParams params = new RequestParams();
        params.put("number", BaseParam.getDeviceId());
        HttpUtil.loadData(PostUrl.GET_DIFFERENT_TITLE, params, DifferentTitleBean.class, callBack);
    }



    //检查版本更新
    public void checkVersion(RequestCallBack callBack){
        RequestParams params = new RequestParams();
        HttpUtil.loadData(PostUrl.CHECK_VERSION, params, CheckVersionBean.class, callBack);
    }

    //判断是否销售
    public void checkSale(String barcode,RequestCallBack callBack){
        RequestParams params=new RequestParams();
        params.put("barCode",barcode);
        HttpUtil.loadData(PostUrl.CHECK_SALE, params, JudgeGoodsSaleBean.class, callBack);
    }

    //维修记录
    public void getRepairRecord(String barcode,RequestCallBack back){
        RequestParams params=new RequestParams();
        params.put("barCode",barcode);
        HttpUtil.loadData(PostUrl.REPAIR_RECORD, params, RePairRecordBean.class, back);
    }
    ///app/sales/post/listFlow流水参数postId
    public void getSpeedList(int id,RequestCallBack back){
        RequestParams params=new RequestParams();
        params.put("postId",id);
        HttpUtil.loadData(PostUrl.GET_SPEED, params, RepaireSpeedBean.class, back);
    }
}
